<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:a="http://richfaces.org/a4j"
	xmlns:rg="http://www.ruijie.com.cn/faces/ui"
	xmlns:h="http://java.sun.com/jsf/html"
	template="/layout/dialogLayout.xhtml">

 	<ui:param name="param_panelTitle" value="添加产品"/>
 	<ui:param name="param_panelWidth" value="400px"/>

	<ui:define name="content">
		<a:form>
			<rg:titlePanel needButton="true" type="writable">
				<rg:fieldSet column="single" >
					<rg:selectOne id="productType" label="产品类型" value="#{inventoryAction.productType}" 
						enableEmpty="true" itemsProvider="#{productTypeProvider}" converter="#{productTypeConverter}" style="width:100px;">
					</rg:selectOne>

					<rg:combobox id="product" ajaxValidation="true" providerParameter="#{inventoryAction.productType}"
						itemsProvider="#{productProvider}" converter="#{productConverter}"
						label="产品信息" value="#{inventoryAction.product}" >
						<a:support event="onselect" reRender="productDetail" ajaxSingle="true" />
						<rg:reference for="productType" />
					</rg:combobox>
					
			      	<rg:inputText id="productQuantity" value="#{inventoryAction.count}" label="购买数量" />
			      	<rg:selectOne id="isGift" value="#{inventoryAction.gift}" label="是否赠品" itemsProvider="#{booleanProvider}" />
					<h:panelGroup id="productDetail">
						<rg:outputText id="productName" value="#{inventoryAction.product.name}" label="产品名称" />
						<rg:outputText id="productSpecification" value="#{inventoryAction.product.specification}" label="产品规格" />
						<rg:outputText id="productprice" value="#{inventoryAction.product.price}" label="产品单价" />
					</h:panelGroup>
				</rg:fieldSet>
				
			    <ui:define name="panelButton">
					<a:commandButton styleClass="button"
						value="#{messages.luyuan_crm_add}" oncomplete="UI.instance.reRender('reRenderInventoryTable');"
						actionListener="#{inventoryAction.addInventory()}" />
					<a:commandButton styleClass="button" value="取消"
						onclick="UI.instance.closeDialog()" />
				</ui:define>
				
			</rg:titlePanel>
		</a:form>
	</ui:define>
</ui:composition>
